<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 遍历数组：就是把数组的元素从头到尾访问一次
        var arr = ['red', 'green', 'blue'];
        for (var i = 0; i < 3; i++) {
            //因为数组的下标或者说索引号是从0开始的，所以 i = 0; i < 3;  而不是 i = 1; i <=3;
            // i是计数器，当索引号使用，arr[i]是数组元素第i个数组元素
            console.log(arr[i]);
        }
    </script>
</head>

<body>

</body>

</html>